<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加分类</title>
    <link rel="stylesheet" href="../../static/plugins/layui/css/layui.css" media="all" th:href="@{/plugins/layui/css/layui.css}"/>
    <link rel="stylesheet" href="../../static/plugins/font-awesome/css/font-awesome.min.css" th:href="@{/plugins/font-awesome/css/font-awesome.min.css}">

    <link rel="stylesheet" type="text/css" href="../../static/simditor/styles/simditor.css" th:href="@{/simditor/styles/simditor.css}"/>

    <script type="text/javascript" src="../../static/simditor/scripts/jquery.min.js" th:src="@{/simditor/scripts/jquery.min.js}"></script>
    <script type="text/javascript" src="../../static/simditor/scripts/module.js" th:src="@{/simditor/scripts/module.js}"></script>
    <script type="text/javascript" src="../../static/simditor/scripts/hotkeys.js" th:src="@{/simditor/scripts/hotkeys.js}"></script>
    <script type="text/javascript" src="../../static/simditor/scripts/uploader.js" th:src="@{/simditor/scripts/uploader.js}"></script>
    <script type="text/javascript" src="../../static/simditor/scripts/simditor.js" th:src="@{/simditor/scripts/simditor.js}"></script>


</head>
<body>
<blockquote class="layui-elem-quote">
    <a onclick="window.location.reload();" style='cursor:pointer;display: inline-block'>
        <img src="../../static/images/refresh.png" height="20" th:src="@{/images/refresh.png}"/>
    </a>&nbsp;
    <a onclick="history.go(-1);" style="color:#009688; cursor:pointer;display: inline-block;margin:5px">病种分类管理</a>><span style="display: inline-block;margin:5px">添加分类</span>
</blockquote>
<div style="margin-left: 15px;">



    <!--/*@thymesVar id="entity" type="com.example.demo.sicktype.bean.SickTypeBean"*/-->
    <form class="layui-form" action="" th:action="@{/Admin/sicktype/save}" method="post" th:object="${entity}">



        <input th:field="*{id}" th:if="*{id!=0}" type="hidden">


        <div class="layui-form-item margin-left">
            <div class="layui-inline">
                <label class="layui-form-label">分类名称</label>
                <div class="layui-input-block">
                    <input type="text" name="title" autocomplete="off" placeholder="请输入分类名称" class="layui-input" th:field="*{title}"  lay-verify="required">
                </div>
            </div>
        </div>

        <div class="layui-form-item margin-left">
            <div class="layui-inline">
                <label class="layui-form-label" >封面图(</label>
                <div class="layui-input-block">
                    <img  width="100px" height="100px" th:src="'/upload/'+*{img}" id="img_header"/>
                    <input type="file" name="file" class="layui-upload-file">
                    <input th:field="*{img}" type="hidden" id="headerimg">
                </div>
            </div>
        </div>


        <div class="layui-form-item margin-left">
            <div class="layui-inline">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="number" name="title" autocomplete="off" placeholder="请输入排序"  class="layui-input" th:field="*{sort}"  lay-verify="required" >
                </div>
            </div>
        </div>


        <div class="layui-form-item margin-left">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="submit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="../../static/plugins/layui/layui.js" th:src="@{/plugins/layui/layui.js}"></script>
<script th:inline="javascript">

    layui.use('form', function(){
        var form = layui.form();
        var $ = layui.jquery;
    });


    layui.use('upload', function(){
        layui.upload({
            url: '/upload/simupload'
            ,success: function(res){
//                alert(res['file_path']);
                if(res['success']){
//                   $('#img_header').src = 'upload'+res['file_path'];
                    $("#img_header").attr('src','/upload/'+res['file_path']);
                    $("#headerimg").val(res['file_path']);
                }
//                console.log(res); //上传成功返回值，必须为json格式

            }
        });
    });

</script>
</body>
</html>